package hz.mobileproject.pda.ui;

import android.content.Context;
import android.media.MediaPlayer;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.VideoView;

/**
 * Created by zmybi on 2017/12/19.
 */

public class CustomVideoView extends VideoView{

    public CustomVideoView(Context context) {
        super(context);
    }

    public CustomVideoView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomVideoView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        //我们重新计算高度
        int width = getDefaultSize(0, widthMeasureSpec);
        int height = getDefaultSize(0, heightMeasureSpec);
        setMeasuredDimension(width, height);
    }

    @Override
    public void setOnPreparedListener(MediaPlayer.OnPreparedListener l) {
        super.setOnPreparedListener(l);
    }



    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        return super.onKeyDown(keyCode, event);
    }

    /*@Override
    public void pause() {
        super.pause();
        if(playListener==null){

        }else {
            playListener.onPause();
        }
    }


    @Override
    public void start() {
        super.start();
        if(playListener==null){

        }else {
            playListener.onStart();
        }
    }


    private PlayListener playListener;
    public interface PlayListener{
        public void onPause();
        public void onStart();

    }

    public void setPlayListener(PlayListener playListener) {
        this.playListener = playListener;
    }*/

}






